package com.mini.constant;

public enum OrderChannelType {

    ORDER_TRADITION(0, "传统"),
    ORDER_BF(1, "BF");

    private int type;

    private String name;

    OrderChannelType(int type, String name) {
        this.type = type;
        this.name = name;
    }

    public int getType() {
        return type;
    }

    public String getName() {
        return name;
    }


    public static OrderChannelType get(Integer type){
        if(type == null){
            return null;
        }

        for(OrderChannelType ct : OrderChannelType.values()){
            if(ct.getType() == type){
                return ct;
            }
        }

        return null;
    }

    public static String getTypeName(Integer type){
        OrderChannelType ct = get(type);
        if(ct == null){
            return null;
        }

        return ct.getName();
    }

}
